04. Simple Mover

Simple Mover

You will now go through the process of implementing your first ROS node in C++.
This node is called simple_mover . As its name implies, this node only has one responsibility, and that is to command joint movements for simple_arm .

Goal

The goal of the simple_mover node is to command each joint in the simple arm and make it swing between -pi/2 to pi/2 over time. Here’s a demonstration of this node in action:

Simple Arm

Topics

To do so, it must publish joint angle command messages to the following topics:

| Topic Name | /simple_arm/joint_1_position_controller/command |
|-|-|
| Message Type | std_msgs/Float64 |
| Description | Commands joint 1 to move counter-clockwise, units in radians |

|**Topic Name ** | /simple_arm/joint_2_position_controller/command |
|-|-|
| Message Type | std_msgs/Float64 |
| Description | Commands joint 2 to move counter-clockwise, units in radians |

Note : If you no longer have the catkin_ws or simple_arm package from the previous lesson, you need to re-create a new catkin_ws and clone the package inside your /home/workspace/catkin_ws/src with:

$ mkdir -p /home/workspace/catkin_ws/src/
$ cd /home/workspace/catkin_ws/src/
$ git clone -b first_interaction https://github.com/udacity/RoboND-simple_arm/ simple_arm

Adding the source directory

In order to create a new node in C++, you must first create the src directory within the simple_arm package, as it does not yet exist.

$ cd /home/workspace/catkin_ws/src/simple_arm/
$ mkdir src

Creating a new script

Once the source directory has been created, C++ scripts can be added to the package. Now, create the simple_mover C++ script inside the source directory of the package.

$ cd /home/workspace/catkin_ws/src/simple_arm/src/
$ touch simple_mover.cpp